export const User = {
    state: {
      user:{},
      token:null
    },
    
    mutations: {
      INITUSER(state, user) {
        state.user = user;
      },
      DELEUSER(state){
        state.user=''
      },
       //保存token
    SAVE_TOKEN(state,token){
      state.token = token
  },
  REMOVE_TOKEN(state){
      state.token = null
  },
    },
    actions: {
      initUser({ commit }, user) {
        commit("INITUSER", user);
      },
      deleUser({commit}){
commit("DELEUSER")
      },
     
  saveToken({commit},token){
    commit('SAVE_TOKEN',token)
},
removeToken({commit}){
    commit('REMOVE_TOKEN')
}
      
    },
  };